<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
  <title>Description of plotunswan</title>
  <meta name="keywords" content="plotunswan">
  <meta name="description" content="Plots a wave parameter on unstructured grid">
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="generator" content="m2html v1.5 &copy; 2003-2005 Guillaume Flandin">
  <meta name="robots" content="index, follow">
  <link type="text/css" rel="stylesheet" href="../m2html.css">
</head>
<body>
<a name="_top"></a>
<div><a href="../index.html">Home</a> &gt;  <a href="index.html">swan_scripts</a> &gt; plotunswan.m</div>

<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
<td align="right"><a href="index.html">Index for swan_scripts&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->

<h1>plotunswan
</h1>

<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>Plots a wave parameter on unstructured grid</strong></div>

<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="box"><strong>function plotunswan(matfile,basename,wavepar); </strong></div>

<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre class="comment"> Plots a wave parameter on unstructured grid

 Example:

 SWAN generated a binary Matlab file called 'f32har01.mat'
 TRIANGLE generated files with basename 'f32hari', e.g. 'f32hari.ele'
 To make a plot of the significant wave height, give the following
 command in Matlab:

     plotunswan('f32har01','f32hari','Hsig')

 For other wave parameters, type the following command:

    who -file f32har01


 Author  : Marcel Zijlema
 Date    : February 13, 2008
 Version : 1.0</pre></div>

<!-- crossreference -->
<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
This function calls:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
This function is called by:
<ul style="list-style-image:url(../matlabicon.gif)">
</ul>
<!-- crossreference -->



<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
<div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function plotunswan(matfile,basename,wavepar);</a>
0002 <span class="comment">% Plots a wave parameter on unstructured grid</span>
0003 <span class="comment">%</span>
0004 <span class="comment">% Example:</span>
0005 <span class="comment">%</span>
0006 <span class="comment">% SWAN generated a binary Matlab file called 'f32har01.mat'</span>
0007 <span class="comment">% TRIANGLE generated files with basename 'f32hari', e.g. 'f32hari.ele'</span>
0008 <span class="comment">% To make a plot of the significant wave height, give the following</span>
0009 <span class="comment">% command in Matlab:</span>
0010 <span class="comment">%</span>
0011 <span class="comment">%     plotunswan('f32har01','f32hari','Hsig')</span>
0012 <span class="comment">%</span>
0013 <span class="comment">% For other wave parameters, type the following command:</span>
0014 <span class="comment">%</span>
0015 <span class="comment">%    who -file f32har01</span>
0016 <span class="comment">%</span>
0017 <span class="comment">%</span>
0018 <span class="comment">% Author  : Marcel Zijlema</span>
0019 <span class="comment">% Date    : February 13, 2008</span>
0020 <span class="comment">% Version : 1.0</span>
0021 
0022 <span class="keyword">if</span> nargin~=3
0023    error(<span class="string">'Wrong number of arguments. See &quot;help plotunswan&quot;'</span>)
0024 <span class="keyword">end</span>
0025 
0026 eval([<span class="string">'load '</span> matfile]);              <span class="comment">% load binary file containing SWAN results</span>
0027                                       <span class="comment">% obtained using BLOCK command with COMPGRID-set</span>
0028 elefile=[basename <span class="string">'.ele'</span>];
0029 fid = fopen(elefile);                 <span class="comment">% load TRIANGLE element based connectivity file</span>
0030 [nelem] = fscanf(fid,<span class="string">'%i'</span>,[1 3]);     <span class="comment">% get number of triangles</span>
0031 tri = fscanf(fid,<span class="string">'%i'</span>,[4 nelem(1)])'; <span class="comment">% get connectivity table</span>
0032 z=eval([wavepar]);                    <span class="comment">% get wave parameter</span>
0033 trisurf(tri(:,2:4),Xp,Yp,z)           <span class="comment">% make plot using trisurf</span>
0034 view(0,90);shading interp;            <span class="comment">% make 2D view and smooth plot</span>
0035 colormap(jet);colorbar;axis equal     <span class="comment">% include colorbar and equal axes</span></pre></div>
<hr><address>Generated on Wed 02-Nov-2011 21:58:00 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" title="Matlab Documentation in HTML">m2html</a></strong> &copy; 2005</address>
</body>
</html>